package com.sparrow.common.ai.behaviortree.node.impl;

import com.sparrow.common.ai.behaviortree.BehaviorContext;
import com.sparrow.common.ai.behaviortree.node.AbstractBehaviorNode;
import com.sparrow.common.ai.behaviortree.node.BehaviorNode;
import com.sparrow.common.ai.behaviortree.task.BehaviorTask;
import com.sparrow.common.ai.behaviortree.task.impl.ConditionTask;

import java.util.Collections;
import java.util.List;

public abstract class ConditionNode extends AbstractBehaviorNode {

    private boolean value;

    @Override
    public BehaviorTask createTask() {
        return new ConditionTask(this, value);
    }

    public void setValue(boolean value) {
        this.value = value;
    }

    public boolean isValue() {
        return value;
    }

    public abstract boolean check(BehaviorContext context);

    @Override
    public List<BehaviorNode> getChildren() {
        return Collections.EMPTY_LIST;
    }

}
